package com.qj.sys;

import com.alibaba.fastjson.JSON;
import com.qj.sys.designPattern.responsibilityChainPattern.ArticleInfo;
import com.qj.sys.designPattern.responsibilityChainPattern.RuleCheckComponent;
import com.qj.sys.designPattern.responsibilityChainPattern.RuleCheckResult;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @author dlw
 * @date 2025-05-29 19:57
 */
@SpringBootTest(classes = SysApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
public class ArticleCheckTest {
    @Resource
    private RuleCheckComponent ruleCheckComponent;
    @Test
    public void testArticle() {
        ArticleInfo articleInfo = new ArticleInfo();
        articleInfo.setTitle("中国人民");
        articleInfo.setContent("起来，不愿做奴隶的人们~");
        RuleCheckResult ruleCheckResult = ruleCheckComponent.checkArticle(articleInfo);
        System.out.println(JSON.toJSON(ruleCheckResult));
    }
}
